<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>

<isperp:grid url="project/monitor/list" gridId="userGrid" altRows="true"
	gridTitle="${pageTitle}" pager="userPager" cusFormatterActions="true"
		excelExportUrl="project/project/excelExport"
	multiselect="false" cusViewUrl="project/project/view">

	<jsp:attribute name="searchbar">
	<table class="search-table">
		<tbody>
			<tr>
				<td class="td1">项目编号：</td>
				<td class="td2"><input type="text" field="code" op="cn">
					</td>
				<td class="td1">项目名称：</td>
				<td class="td2"><input type="text" field="name" op="cn">
					</td>
				<td class="td1">项目级别：</td>
				<td class="td2"><input type="text" field="projectLevel" op="cn">
					</td>
			</tr>

			<tr>
				<td class="td1">项目经理：</td>
				<td class="td2"><input type="text" field="managerName" op="cn">
					</td>
				<td class="td1">销售：</td>
				<td class="td2"><input type="text" field="sellerName" op="cn">
					</td>
				<td class="td1">项目状态：</td>
				<td class="td2"><input type="text" field="status" op="cn">
					</td>
			</tr>
			<tr>
			    <td class="td1">合同编号：</td>
				<td class="td2" colspan="5"><input type="text" field="contractNo" op="in" style="width: 398px"
						placeholder="多个合同编号搜索可用逗号（,）隔开，如（CT01,CT02）">
				</td>

			</tr>
		</tbody>
	</table>
	</jsp:attribute>
	<jsp:body>
	<isperp:column name="id" title="id" hidden="true" ></isperp:column>
	<%-- <isperp:column name="projectLevel" align="center" title="" width="28"
			isFormatterFun="true" formatter="return levelFormatter(cellvalue);">
	</isperp:column> --%>
	<isperp:column name="code" title="项目编号" width="80">
	</isperp:column>
	<isperp:column name="name" title="项目名称" width="160">
	</isperp:column>
	<isperp:column name="contractNo" title="合同编号" width="120">
	</isperp:column>
	<isperp:column name="managerName" title="项目经理" width="80">
	</isperp:column>
	<isperp:column name="sellerName" title="销售" width="80">
	</isperp:column>
	<isperp:column name="cusCustomerName" title="客户" width="80">
	</isperp:column>
	<%-- <isperp:column name="projectLevel" title="级别" width="80" showInHead="false">
	</isperp:column> --%>
	<isperp:column name="status" title="项目状态" width="80">
	</isperp:column>
	<isperp:column name="costStatus" title="成本" width="40"
			isFormatterFun="true"
			formatter="return statusFormatter(cellvalue,rowObject.id,1,rowObject.name);">

	</isperp:column>
	<isperp:column name="processStatus" title="进度" width="40"
			isFormatterFun="true"
			formatter="return statusFormatter(cellvalue,rowObject.id,2,rowObject.name);">
	</isperp:column>
	<isperp:column name="qualityStatus" title="质量" width="40"
			isFormatterFun="true"
			formatter="return statusFormatter(cellvalue,rowObject.id,3,rowObject.name);">
	</isperp:column>
	</jsp:body>

</isperp:grid>

<isperp:operate code="PROJ_MONITOR"></isperp:operate>

<script type="text/javascript">
	function levelFormatter(cellvalue) {
		if (cellvalue == 'A级')
			return "<img title='A级项目' src='img/project/pa.png'>";
		else if (cellvalue == 'B级')
			return "<img title='B级项目' src='img/project/pb.png'>";
		else if (cellvalue == 'C级')
			return "<img title='C级项目' src='img/project/pc.png'>";
		else if (cellvalue == 'D级')
			return "<img title='D级项目' src='img/project/pd.png'>";
		else if (cellvalue == 'E级')
			return "<img title='E级项目' src='img/project/pe.png'>";
	}

	function statusFormatter(cellvalue, rowid, type, name) {
		if (cellvalue == 0)
			return "<img onclick=\"openTraceDetail('" + rowid + "','" + type + "','" + name + "');\" src='img/incident/normal.png'>";
		else
			return "<img onclick=\"openTraceDetail('" + rowid + "','" + type + "','" + name + "');\" src=\"img/incident/unusual.png\">";

	}
	function openTraceDetail(projectId, type, name) {
		var tempTitle;
		var tempUrl;
		if (type == 1) {
			tempTitle = name + "-成本监控";
			tempUrl = "project/project/cost/costAccountingView?projectId=" + projectId;
		} else if (type == 2) {
			tempTitle = name + "-进度监控";
			tempUrl = "ReportServer?reportlet=project/projectProcessingTrackOutline.cpt&op=view&projectId=" + projectId;
		} else {
			tempTitle = name + "-质量监控";
			tempUrl = "ReportServer?reportlet=project/projectSLATrack.cpt&op=view&projectId=" + projectId;
		}

		var options = {
			title : tempTitle,
			contentUrl : tempUrl
		};
		isperp.openDialog(options);
	}
</script>

</div>
